package wrappers

import (
	"github.com/micro/go-micro/v2/client"
	"fmt"
	"context"
)

type logWrapper struct { //官方提供的例子，创建自己的struct，嵌套go-micro的client
    client.Client
}

//重写Call方法
func (this *logWrapper) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error {
    fmt.Println("调用接口") //这样每一次调用调用接口时都会
    return this.Client.Call(ctx, req, rsp)
}

func NewLogWrapper(c client.Client) client.Client {
    return &logWrapper{c}
}